﻿<div class="config_json">
    <ol class="breadcrumb">
        <li><a ui-sref="config.list">配置列表</a></li>
        <li><a ui-sref="config.add">从Json文件导入</a></li>
    </ol>

    <p>
        <div class="form-inline">
            所属应用：
            <select ng-model="selectedAppId" class="form-control">
                <option ng-repeat="app in apps" value="{{app.id}}">
                    {{app.name}}({{app.id}})
                </option>
            </select>
            <button class="btn btn-success btn-sm" ng-click="selectFile()">选择文件</button>
            <input type="file" id="file" ng-hide="true" />
        </div>

    </p>
    <div class="preview-bar">
        <div>预览</div>
        <div>已选择：{{selectedRows()}}行</div>
    </div>
    <div class="preview" style="max-height:600px; overflow-x: auto; overflow-y:auto">
        <table class="table-hover">
            <tr>
                <th>选择</th>
                <th>键</th>
                <th>值</th>
                <th>组</th>
            </tr>
            <tr ng-repeat="config in configs" ng-class="config.selected?'row-selected':''" ng-click="selectRow(config)">
                <td>
                    <span ng-show="config.selected" class="glyphicon glyphicon-ok"></span>
                </td>
                <td ng-bind="config.key"></td>
                <td ng-bind="config.value"></td>
                <td ng-bind="config.group"></td>
            </tr>
        </table>
    </div>
    <p>
    </p>
    <div class="action-bar">
        <button type="button" class="btn btn-primary" ng-show="selectedRows() > 0" ng-click="import()" ng-disabled="adding">导入</button>
        <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
    </div>
    <div class="text-danger">
        {{error_message}}
    </div>
</div>